package com.cobra.rdd.operator.transform

import org.apache.spark.{HashPartitioner, SparkConf, SparkContext}

//key-value类型 partitionby
object Spark21_RDD_Operator_Transform_reduceByKey {
  def main(args: Array[String]): Unit = {
    val sparkConf = new SparkConf().setMaster("local[*]").setAppName("Spark21_RDD_Operator_Transform_reduceByKey")
    val sc = new SparkContext(sparkConf)
   val rdd = sc.makeRDD(List(
     ("a",1),("a",2),("a",3),("b",4)
   ))
    rdd.reduceByKey(_+_).collect().foreach(println)
    sc.stop()
  }
}
